package com.reremouse.rerebbs.model;

import com.reremouse.ejb.impl.IPSeekerService;
import com.reremouse.util.HTMLCleaner;
import com.reremouse.util.SpringHelper;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

@Entity
@Table(name = "rerebbs_talk")
public class BbsTalk
        implements Serializable {
    @Id
    @Column(name = "id", unique = true, nullable = false)
    private Long id = Long.valueOf(System.nanoTime());
    @Column(name = "content", length = 65535)
    private String content;
    @ManyToOne(targetEntity = BbsThread.class, cascade = {})
    @JoinColumn(name = "threadId")
    private BbsThread thread;
    @Column(name = "genTime", nullable = false, length = 0)
    @Temporal(TemporalType.TIMESTAMP)
    private Date genTime;
    @Column(name = "lastEditTime", nullable = false, length = 0)
    @Temporal(TemporalType.TIMESTAMP)
    private Date lastEditTime;
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "genBy")
    private BbsUser genBy;
    @Column(name = "ifPub")
    private Boolean ifPub = Boolean.valueOf(true);
    @Column(name = "ip")
    private String ip;
    @Transient
    private String ipAddr;
    @Transient
    private String cleanContent;

    public BbsTalk() {
    }

    public BbsTalk(Long id, Date genTime, Date lastEditTime) {
        this.id = id;
        this.genTime = genTime;
        this.lastEditTime = lastEditTime;
    }

    public Long getId() {
        return this.id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getContent() {
        return this.content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public BbsThread getThread() {
        return this.thread;
    }

    public void setThread(BbsThread thread) {
        this.thread = thread;
    }

    public Date getGenTime() {
        return this.genTime;
    }

    public void setGenTime(Date genTime) {
        this.genTime = genTime;
    }

    public Date getLastEditTime() {
        return this.lastEditTime;
    }

    public void setLastEditTime(Date lastEditTime) {
        this.lastEditTime = lastEditTime;
    }

    public BbsUser getGenBy() {
        return this.genBy;
    }

    public void setGenBy(BbsUser genBy) {
        this.genBy = genBy;
    }

    public Boolean getIfPub() {
        return this.ifPub;
    }

    public void setIfPub(Boolean ifPub) {
        this.ifPub = ifPub;
    }

    public String getIp() {
        return this.ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    public String getIpAddr() {
        IPSeekerService ips = (IPSeekerService) SpringHelper.getSpringBean("ipSeekerService");
        if (this.ip != null) {
            this.ipAddr = ips.seek(this.ip);
        }
        return this.ipAddr;
    }

    public void setIpAddr(String ipAddr) {
        this.ipAddr = ipAddr;
    }

    public String getCleanContent() {
        this.cleanContent = HTMLCleaner.delHTMLTag(this.content);
        return this.cleanContent;
    }

    public void setCleanContent(String cleanContent) {
        this.cleanContent = cleanContent;
    }
}



/* Location:           F:\jsp源码\蝙蝠论坛系统\rerebbs\WEB-INF\classes\

 * Qualified Name:     com.reremouse.rerebbs.model.BbsTalk

 * JD-Core Version:    0.7.0.1

 */